{% extends "based/based_no_sidebar.html" %}
{% block title %}{{_("密码安全")}}-{% endblock %}
{% block content %}
<div id="app" class="row osr-edit-page">
    <section class="osr-panel">
      <header class="panel-heading tab-bg-dark-navy-blue osr-panel-heading">
          <strong>{{_("密码修改")}}</strong>
          <a class="pull-right" href="/osr-admin/own/account/settings?set=basis">
                <i class="fa fa-arrow-circle-left"></i>
              {{_("返回")}}
          </a>
      </header>
      <div class="panel-body">
          <div class="form-group">
              <label>{{_('当前密码')}}</label>
              <input name="old-passowrd" class="form-control osr-input" type="password" v-model="now_password" id="now_password"
                   placeholder="{{_('当前密码')}}" minlength="8"
                   data-bv-notempty-message="{{_('密码错误')}}"
                   data-bv-stringLength-message="{{_('密码错误')}}" required/>
            </div>
            <div class="form-group">
              <label>{{_('新密码')}}</label>
              <input name="password" class="form-control osr-input" type="password" v-model="password" id="password"
                     placeholder="{{_('新密码')}}" minlength="8"
                     data-bv-notempty-message="{{_('至少8个字符')}}"
                     data-bv-stringLength-message="{{_('至少8个字符')}}" required/>
            </div>
            <div class="form-group">
              <label>{{_('确认密码')}}</label>
              <input name="password2" class="form-control osr-input" type="password" v-model="password2" id="password2"
                     placeholder="{{_('确认密码')}}" data-bv-identical="true"
                     data-bv-notempty-message="{{_('至少8个字符')}}"
                     data-bv-identical-message="{{_('前后密码不一致')}}"

                     data-bv-identical-field="password" required>
            </div>
            <button v-on:click="reset()" class="btn osr-btn btn-info osr-submit-btn">
                {{_('重设')}}
            </button>
      </div>
    </section>
</div>

<script>
    var vue = new Vue({
      el: '#app',
      delimiters:['{[', ']}'],
      data: {
        username:'',
        email:'',
        now_password:'',
        password: '',
        password2: '',
      }
    })

    $(document).ready(function(){

    });

    function reset(){
        formValidate();
        var d = {now_password:vue.now_password,
                    password:vue.password,
                    password2:vue.password2};
        // 提交数据
        osrHttp("PUT", "/api/account/password/reset", d);
    }

</script>
{% endblock %}
